package cn.smxy.ln.controller;

import cn.smxy.ln.common.lang.Result;
import cn.smxy.ln.pojo.Project;
import cn.smxy.ln.service.ProjectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author ln
 * @date 2022年05月24日 19:53
 */
@RestController
@RequestMapping("/project/consumer")
public class ProjectController {

    @Autowired
    ProjectService projectService;

    @GetMapping("/list")
    public Result queryAll() {
        return Result.succ(projectService.queryAll());
    }

    @PostMapping("/save")
    public Result save(@RequestBody Project project) {
        return Result.succ(projectService.save(project));
    }

    @PostMapping("/delete")
    public Result delete(@RequestParam(value = "id") Long id) {
        return Result.succ(projectService.delete(id));
    }

    @PostMapping("/update")
    public Result update(@RequestBody Project project) {
        return Result.succ(projectService.update(project));
    }
}
